<div>
    <h2>
        <span jhiTranslate="greatBigExampleApplicationApp.article.home.title">Articles</span>
        <button class="btn btn-primary float-right create-article" [routerLink]="['/', { outlets: { popup: ['article-new'] } }]">
            <span class="fa fa-plus"></span>
            <span class="hidden-sm-down"  jhiTranslate="greatBigExampleApplicationApp.article.home.createLabel">
            Create new Article
            </span>
        </button>
    </h2>
    <jhi-alert></jhi-alert>
    <div class="row">
        <div class="col-sm-12">
            <form name="searchForm" class="form-inline">
                <div class="input-group w-100 mt-3">
                    <input type="text" class="form-control" [(ngModel)]="currentSearch" id="currentSearch" name="currentSearch" placeholder="{{ 'greatBigExampleApplicationApp.article.home.search' | translate }}">
                    <button class="input-group-addon btn btn-info" (click)="search(currentSearch)">
                        <span class="fa fa-search"></span>
                    </button>
                    <button class="input-group-addon btn btn-danger" (click)="clear()" *ngIf="currentSearch">
                        <span class="fa fa-trash-o"></span>
                    </button>
                </div>
            </form>
        </div>
    </div>
    <br/>
    <div class="table-responsive" *ngIf="articles">
        <table class="table table-striped">
            <thead>
                <tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
                    <th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="slug"><span jhiTranslate="greatBigExampleApplicationApp.article.slug">Slug</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="title"><span jhiTranslate="greatBigExampleApplicationApp.article.title">Title</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="description"><span jhiTranslate="greatBigExampleApplicationApp.article.description">Description</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="body"><span jhiTranslate="greatBigExampleApplicationApp.article.body">Body</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="createdAt"><span jhiTranslate="greatBigExampleApplicationApp.article.createdAt">Created At</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="updatedAt"><span jhiTranslate="greatBigExampleApplicationApp.article.updatedAt">Updated At</span> <span class="fa fa-sort"></span></th>
                    <th jhiSortBy="author.login"><span jhiTranslate="greatBigExampleApplicationApp.article.author">Author</span> <span class="fa fa-sort"></span></th>
                    <th></th>
                </tr>
            </thead>
            <tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
                <tr *ngFor="let article of articles ;trackBy: trackId">
                    <td><a [routerLink]="['../article', article.id ]">{{article.id}}</a></td>
                    <td>{{article.slug}}</td>
                    <td>{{article.title}}</td>
                    <td>{{article.description}}</td>
                    <td>{{article.body}}</td>
                    <td>{{article.createdAt | date:'medium'}}</td>
                    <td>{{article.updatedAt | date:'medium'}}</td>
                    <td>
                        <div *ngIf="article.author">
                            <a [routerLink]="['../author', article.author?.id ]">{{article.author?.user.login}}</a>
                        </div>
                    </td>
                    <td class="text-right">
                        <div class="btn-group flex-btn-group-container">
                            <button type="submit" [routerLink]="['../article', article.id ]" class="btn btn-info btn-sm">
                            <span class="fa fa-eye"></span>
                            <span class="hidden-md-down" jhiTranslate="entity.action.view">View</span>
                        </button>
                            <button type="submit" [routerLink]="['/', { outlets: { popup: 'article/'+ article.id + '/edit'} }]" replaceUrl="true" class="btn btn-primary btn-sm">
                            <span class="fa fa-pencil"></span>
                            <span class="hidden-md-down" jhiTranslate="entity.action.edit">Edit</span>
                        </button>
                            <button type="submit" [routerLink]="['/', { outlets: { popup: 'article/'+ article.id + '/delete'} }]" replaceUrl="true" class="btn btn-danger btn-sm">
                            <span class="fa fa-remove"></span>
                            <span class="hidden-md-down" jhiTranslate="entity.action.delete">Delete</span>
                        </button>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
